<template>
	<view class="body">
		<input v-model="email" class="uni-input" placeholder="请输入需要绑定的邮箱" />
		<input password v-model="password" class="uni-input" placeholder="请输入密码" />
		<button class="confirm main-button" hover-class="button-hover" @tap="submit">确认修改</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				email: "",
				password: "",
				patrn: /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
			};
		},
		methods: {
			// 检验密码
			chack() {
				if (this.password.trim() && this.patrn.exec(this.email)) {
					return true
				}
				return false
			},
			submit() {
				if (this.chack()) {
					uni.showToast({
						title: "修改中",
						icon: "loading"
					})
				} else {
					uni.showToast({
						title: "邮箱或密码错误",
						icon: "none"
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.body {
		padding: 0 30upx;
		overflow: hidden;

		.uni-input {
			margin: 23upx auto;
			width: 90%;
			border-bottom: 1upx solid #DDDDDD;
		}

		.confirm {
			margin-top: 50upx !important;

			&.button-hover {
				background-color: #cab528;
			}
		}
	}
</style>
